package org.ohos.rajawali3d.examples.wallpaper;

import ohos.aafwk.ability.Ability;
import ohos.aafwk.content.Intent;


/**
 * @author Jared Woolston (jwoolston@idealcorp.com)
 */
public class PreviewActivity extends Ability {
    @Override
    public void onStart(Intent icicle) {
        super.onStart(icicle);

        Intent intent = new Intent();

//        if (Build.VERSION.SDK_INT >= 16) {
        /*
         * Open live wallpaper preview (API Level 16 or greater).
         */
//            intent.setAction(WallpaperManager.ACTION_CHANGE_LIVE_WALLPAPER);
//            String pkg = Service.class.getPackage().getName();
//            String cls = Service.class.getCanonicalName();
//            intent.putExtra(WallpaperManager.EXTRA_LIVE_WALLPAPER_COMPONENT, new ComponentName(pkg, cls));
//        } else {
        /*
         * Open live wallpaper picker (API Level 15 or lower).
         *
         * Display a quick little message (toast) with instructions.
         */
//            intent.setAction(WallpaperManager.ACTION_LIVE_WALLPAPER_CHOOSER);
//            Resources res = getResources();
//            String hint = res.getString(R.string.picker_toast_prefix)
//                + res.getString(R.string.lwp_name)
//                + res.getString(R.string.picker_toast_suffix);
//            Toast toast = Toast.makeText(this, hint, Toast.LENGTH_LONG);
//            toast.show();
//        }
        startAbilityForResult(intent, 0);
    }

    @Override
    protected void onAbilityResult(int requestCode, int resultCode, Intent intent) {
        super.onAbilityResult(requestCode, resultCode, intent);
        terminateAbility();
    }
}
